<template>
  <div id="app">
    <img alt="Vue logo" src="./assets/logo.png" />
    <h2>用户id：{{userId}}</h2>
  </div>
</template>

<script lang="ts">
import { Component, Vue } from "vue-property-decorator";
import { ThirdPartyService } from '@/service/ThirdPartyService';

@Component({})
export default class App extends Vue {
  private tp = ThirdPartyService.getInstance();

  public userId: string = "";

  public created(): void {
    this.login();
  }

  public login() {
    this.tp.clearUserInfo();
    setTimeout(async () => {
      if (this.tp.isInit) {
       this.userId = await this.tp.login();
      } else {
        this.login();
      }
    }, 10);
  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
